package com.mark.design.principle.dependenceinversion;

/**
 * 高层：应用层
 * author:Mark
 * date:2018/8/19  22:23
 */
public class Test {
    //v1
   /* public static void main(String[] args) {
        Mark mark = new Mark();
        mark.studyFECourse();
        mark.studyJavaCourse();
    }*/

    //v2
   /* public static void main(String[] args) {
        Mark mark = new Mark();
        mark.studyImoocCourse(new JavaCourse());
        mark.studyImoocCourse(new FECourse());
    }*/

    //v3:通过构造函数注入ICourse
   /* public static void main(String[] args) {
        Mark mark = new Mark(new JavaCourse());
        mark.studyImoocCourse();

        mark = new Mark(new FECourse());
        mark.studyImoocCourse();
    }*/

    //v4:set方法注入
    public static void main(String[] args) {
        Mark mark = new Mark();
        mark.setiCourse(new JavaCourse());
        mark.studyImoocCourse();

        mark.setiCourse(new FECourse());
        mark.studyImoocCourse();
    }
}
